package com.open.capacity.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.open.capacity.common.model.SttPermission;
import com.open.capacity.common.model.SysPermission;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
* @author 作者 owen 
* @version 创建时间：2017年11月12日 上午22:57:51
 * 权限
 */
@Component
public interface SysPermissionDao  extends BaseMapper<SttPermission> {

	@Options(useGeneratedKeys = true, keyProperty = "premid")
	@Insert("insert into stt_permission(peruri, pename) values(#{permission}, #{name})")
	int save(SttPermission sttPermission);
	@Delete("delete from stt_permission where premid = #{id}")

	int deleteByPrimaryKey(Long id);
	
	@Update("update stt_permission t set t.pename = #{name}, t.peruri = #{permission} where t.premid = #{id}")
	int updateByPrimaryKey(SttPermission sysPermission);

	
	@Select("select premid id, peruri permission, pename name, crtime createTime  , uptime updateTime from stt_permission t where t.premid = #{id}")
	SttPermission findById(Long id);

	@Select("select premid id, peruri permission, pename name, crtime createTime  , uptime updateTime   from stt_permission t where t.peruri = #{peruri}")
	SttPermission findByPermission(String permission);

	int count(Map<String, Object> params);

	List<SttPermission> findList(Map<String, Object> params);

}
